begintownscript;
variables;

body;
beginstate INIT_STATE;
    add_range_to_group(9, 11, 1);
    set_level(1001, 18);
break;
beginstate EXIT_STATE;

break;
beginstate START_STATE;
    if (char_ok(6) == 0)
    if (get_flag(9, 29) == 0)
        message_dialog("It would appear that you have killed the leader of the ogres. Now, the ogres should be scared enough to never find their way here again.", "");
    set_flag(9, 29, 1);
break;
beginstate 10;
    if (get_flag(9, 0) == 0)
        message_dialog("The mines are very quiet and eerie. Something is lurking down there.", "For some reason you don't think you'll have to fight here.");
    set_flag(9, 0, 1);
break;
beginstate 11;
    if (get_flag(9, 1) == 0)
        message_dialog("This abandoned hole must be a section which the miners already emptied of metals.", "To the right you see a small building with no lights turned on in it.");
    set_flag(9, 1, 1);
break;
beginstate 12;
    if (get_flag(9, 2) == 0)
        message_dialog("The ogres have built a stable barricade here, blocking your movement. They, however, make no moves of offense.", "You catch glimpses of small objects with pedestals on the floor behind the wall.");
    set_flag(9, 2, 1);
break;
beginstate 13;
    if ((get_flag(9, 3) == 0) && (get_terrain(25, 17) == 58))
    {
        message_dialog("From here you have an excellent view of the mine. The ogres seem to have sealed the captured miners in a hole in the back wall.", "Then you realize one interesting thing. There are explosives everywhere. Blowing up one would start a chain reaction which would kill all ogres. You wonder how you could blow up one");
        set_flag(9, 2, 1);
    }
break;
beginstate 14;
    change_outdoor_location(0, 0, 1, 14);
break;
beginstate 15;
    change_outdoor_location(0, 0, 1, 19);
break;
beginstate 16;
    if (char_ok(10))
    {
    if (get_flag(9, 6) == 0)
    {
        message_dialog("The miners captured by the ogres were sealed back here. They seem pleased when they see you. One of them says:", "_Thank you! We were afraid that they'd eat us, you know. But now that you set us free we can go back to Goldar, you know return._");
    }    
    set_flag(9, 6, 1);
    if (get_terrain(6, 28) == 66)
    {
        message_dialog("_You opened the dock for us. Good! We'll be rowing towards Goldar. By the way, you can keep the other boat._", "");
        if (has_special_item(1))
        {
            message_dialog("_And may I have my key back?_ You hand it over. _Thanks!_", "");
            change_spec_item(1, -1);
        }
        erase_char(1001);
        set_boat_property(3, 1);
        set_flag(106, 21, 2);
        set_creature_memory_cell(1001, 0, 0);
        create_boat(2, 7, 5, 0, 0);
    }
    else message_dialog("_By the way, could you go open the dock for us. The control room is to the left of that barricade, near the big hole._", "");
    }
break;